home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / recurs1a / wbrdom.frm < prev    next >
Text File  |  1999-08-27  |  4KB  |  134 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.MDIForm mdiWbrDOM 
  4.    BackColor       =   &H8000000C&
  5.    ClientHeight    =   3510
  6.    ClientLeft      =   1260
  7.    ClientTop       =   630
  8.    ClientWidth     =   5280
  9.    NegotiateToolbars=   0   'False
  10.    ScrollBars      =   0   'False
  11.    Begin MSComctlLib.StatusBar sta 
  12.       Align           =   2  'Align Bottom
  13.       Height          =   315
  14.       Left            =   0
  15.       TabIndex        =   0
  16.       Top             =   3195
  17.       Width           =   5280
  18.       _ExtentX        =   9313
  19.       _ExtentY        =   556
  20.       Style           =   1
  21.       _Version        =   393216
  22.       BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
  23.          NumPanels       =   1
  24.          BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  25.          EndProperty
  26.       EndProperty
  27.    End
  28.    Begin VB.Menu mnuFileMenu 
  29.       Caption         =   "&File"
  30.       Begin VB.Menu mnuFileOpen 
  31.          Caption         =   "&Open..."
  32.          Shortcut        =   ^O
  33.       End
  34.       Begin VB.Menu mnuFileBar1 
  35.          Caption         =   "-"
  36.       End
  37.       Begin VB.Menu mnuFileExit 
  38.          Caption         =   "E&xit"
  39.       End
  40.    End
  41. End
  42. Attribute VB_Name = "mdiWbrDOM"
  43. Attribute VB_GlobalNameSpace = False
  44. Attribute VB_Creatable = False
  45. Attribute VB_PredeclaredId = True
  46. Attribute VB_Exposed = False
  47. Option Explicit
  48. ' Questions contact markb@orionstudios.com
  49. ' Demonstrates DOM programming from Vb6 including
  50. '   build document in empty WebBrowser Control
  51. '   build DIV element as progress display
  52. '   build Stylesheet with code
  53. '   convert tab-deliited text to HTML Table with
  54. '       Header, Footer, Caption, Column definitions
  55. '   enable/disable formatting
  56. '   replace standard context (right-click) popup menu
  57. '   set document title, table caption
  58. '   save constructed document as HTML
  59. '   generalised class to recurse document structure
  60. '   extract stylesheet information
  61. '   build UL object with expand/collapse
  62. '   cloning
  63. '   intercept events from WebBrowser document
  64. '   using a behavior
  65. '
  66. ' Requires Project/References entry for
  67. '   Microsoft HTML Object Library (MSHTML.tlb)
  68. '=================================================================================
  69. Private mDefaultPath As String
  70.  
  71. Public Property Let StatusText(ByVal vData As String)   ' Messages from child forms
  72.     sta.SimpleText = vData                              ' with no status bar.
  73.     sta.Refresh
  74. End Property
  75.  
  76. Private Sub MDIForm_Load()
  77.  
  78.     Me.Move 1200, 0, 9000, 8400
  79.     Me.Caption = App.FileDescription
  80.     mDefaultPath = App.Path & "\"
  81.  
  82. End Sub
  83.  
  84. Private Sub mnuFileOpen_Click()
  85.  
  86.     Dim strFileName As String
  87.     
  88.     strFileName = GetFileName
  89.     If Len(strFileName) Then
  90.         With New frmDOMTable
  91.             Set .MDIParent = Me
  92.             .DataFileSpec = strFileName
  93.             .Show
  94.         End With
  95.     End If
  96.  
  97. End Sub
  98.  
  99. Private Sub mnuFileExit_Click()
  100.     Unload Me
  101. End Sub
  102.  
  103. Private Function GetFileName() As String
  104. '
  105. ' Returns full path of selected existing file. Uses FileDlg.cls.
  106. '
  107.     On Error GoTo GetFileName_Error
  108.     
  109.     Dim Result As String    ' default function result = ""
  110.     Dim strFileName As String
  111.     
  112.     With New FileDlg
  113.         .Title = "Select tab-delimited text file"
  114.         .DefaultDir = mDefaultPath & "Work"
  115.         .Owner = Me.hWnd
  116.         .AddFilter "Tab-delimited Text Files (*.txt,*tab):*.txt;*tab"
  117.         If .Show(DlgType:=OpenDialog) Then
  118.             strFileName = .PathFile
  119.         End If
  120.     End With
  121.     DoEvents
  122.     Result = strFileName
  123.     
  124. GetFileName_Exit:
  125.     GetFileName = Result
  126.     Exit Function
  127.  
  128. GetFileName_Error:
  129.     MsgBox Err.Number & " - " & Err.Description, vbExclamation, "GetFileName"
  130.     Resume GetFileName_Exit
  131.  
  132. End Function
  133.  
  134.